package com.yjt.fresh.widget;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;

import com.yjt.fresh.utils.CommonsToolsHelper;

/**
 * Created by UPC on 2018/6/13.
 */

public class NumView extends View {
    private Paint mPaint;
    private Context mContext;

    public NumView(Context context) {
        this(context,null);
    }

    public NumView(Context context, @Nullable AttributeSet attrs) {
        this(context,attrs,0);
    }

    public NumView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        mContext = context;
        init();
    }

    private void init() {
        mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mPaint.setDither(true);
        mPaint.setColor(Color.RED);
        mPaint.setStyle(Paint.Style.FILL);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        canvas.drawText("780.00", CommonsToolsHelper.dip2px(mContext,80),CommonsToolsHelper.dip2px(mContext,18),mPaint);
    }
}
